var e = require("../../@babel/runtime/helpers/interopRequireDefault"), t = e(require("../../@babel/runtime/regenerator")), r = require("../../@babel/runtime/helpers/asyncToGenerator"), a = e(require("../../http/order")), n = getApp(), s = new a.default();

Page({
    data: {
        titleBarTotalHeight: n.global.systemInfo.titleBarTotalHeight
    },
    onLoad: function(e) {
        var a = this;
        return r(t.default.mark(function r() {
            return t.default.wrap(function(t) {
                for (;;) switch (t.prev = t.next) {
                  case 0:
                    return a.orderId = e.orderId, t.prev = 1, n.showLoading(), t.next = 5, a.getOrderDetails();

                  case 5:
                    return t.next = 7, a.getLogisticsDetails();

                  case 7:
                    t.next = 12;
                    break;

                  case 9:
                    t.prev = 9, t.t0 = t.catch(1), console.log(t.t0);

                  case 12:
                    return t.prev = 12, wx.hideLoading(), t.finish(12);

                  case 15:
                  case "end":
                    return t.stop();
                }
            }, r, null, [ [ 1, 9, 12, 15 ] ]);
        }))();
    },
    copyOnTap: function() {
        wx.setClipboardData({
            data: this.data.order.deliverySn
        });
    },
    getOrderDetails: function() {
        var e = this;
        return r(t.default.mark(function r() {
            var a;
            return t.default.wrap(function(t) {
                for (;;) switch (t.prev = t.next) {
                  case 0:
                    return t.next = 2, s.getOrderDetail(e.orderId);

                  case 2:
                    a = t.sent, e.setData({
                        order: a.data
                    });

                  case 4:
                  case "end":
                    return t.stop();
                }
            }, r);
        }))();
    },
    getLogisticsDetails: function() {
        var e = this;
        return r(t.default.mark(function r() {
            var a;
            return t.default.wrap(function(t) {
                for (;;) switch (t.prev = t.next) {
                  case 0:
                    return t.next = 2, s.LogisticsInformation(e.orderId);

                  case 2:
                    0 == (a = t.sent).data.list.length && a.data.list.push({
                        msg: "暂无物流轨迹"
                    }), e.setData({
                        logistics: a.data
                    });

                  case 5:
                  case "end":
                    return t.stop();
                }
            }, r);
        }))();
    }
});